<template>
  <div id="side-nav">
    <div class="menu">
      <div v-for="item in menu" :key="item.title" @click="$router.push(item.to)" class="menu-item"
           :class="{'menu-item-chosen': item.page.includes($route.name)}">{{ item.title }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      menu: [
        {
          title: '控制台',
          to: {
            name: 'console'
          },
          page: ['console']
        },
        {
          title: '我的待办',
          to: {
            name: 'todo'
          },
          page: ['todo']
        },
        {
          title: '我的课程',
          to: {
            name: 'course'
          },
          page: ['course', 'course-detail']
        },
        {
          title: '我的团队',
          to: {
            name: 'team'
          },
          page: ['team', 'team-detail']
        },
        {
          title: '个人信息',
          to: {
            name: 'me'
          },
          page: ['me']
        },
      ]
    }
  },
  methods: {},
}
</script>

<style scoped lang="scss">
#side-nav {
  box-shadow: 1px 1px 3px 3px #fafafa;
  padding: 30px;
  border-radius: 20px;
}

.menu {
  width: 200px;

  .menu-item {
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;

    &:hover {
      color: #0080ff;
    }
  }

  .menu-item-chosen {
    color: #0080ff;
  }
}
</style>